
Q := @
CXX = g++

EIGEN_PATH := ../eigen
PSLITE_PATH := ..

INCLUDE := -I$(EIGEN_PATH)
INCLUDE += $(shell python3 -m pybind11 --includes)
INCLUDE += -I../include

CXXFLAGS := -std=c++11 -g $(INCLUDE) -shared -fPIC -DMODULE=$(MODULE)
LIBS := -lps -lpthread  -lzmq -l:libprotobuf.a
LDFLAGS := -L$(PSLITE_PATH)/build -L$(PSLITE_PATH)/deps/lib

SRC = $(MODULE).c
DEP := $(MODULE).d
OBJS := $(MODULE).o

TARGET=$(MODULE)$(shell python3-config --extension-suffix)
all: $(OBJS) $(DEP)
	$(CXX) $(CXXFLAGS) $(OBJS) -o $(TARGET) $(LDFLAGS) $(LIBS)

.PHONY: clean
clean:
	$(Q) -rm $(shell find ./ -name *.o)
	$(Q) -rm $(shell find ./ -name *.d)

sinclude ./rules.mk
sinclude $(DEP)
